﻿using System;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;

namespace SizeboxUI
{
	// Token: 0x020003AE RID: 942
	public class CloudSettingsView : SettingsView
	{
		// Token: 0x060018E9 RID: 6377 RVA: 0x0009CE80 File Offset: 0x0009B080
		private void Start()
		{
			Button[] componentsInChildren = base.gameObject.GetComponentsInChildren<Button>();
			foreach (Button button in componentsInChildren)
			{
				if (button.gameObject.name == "SpawnClouds")
				{
					this.mSpawnButton = button;
				}
				else if (button.gameObject.name == "RemoveClouds")
				{
					this.mClearButton = button;
				}
			}
			this.mSpawnButton.onClick.AddListener(new UnityAction(this.Spawn));
			this.mClearButton.onClick.AddListener(new UnityAction(this.Clear));
			base.GetComponentInChildren<Text>().text = "Adv Clouds";
			this.mUseSimpleClouds = base.AddToggle("Simple Clouds");
			this.mUseSimpleClouds.onValueChanged.AddListener(new UnityAction<bool>(this.OnuseSimpleCloudsChanged));
			this.mOvercast = base.AddToggle("Overcast");
			this.mOvercast.onValueChanged.AddListener(new UnityAction<bool>(this.OnovercastChanged));
			this.mAltitude = base.AddNumberedSlider("Altitude", 0f, 20f);
			this.mAltitude.onValueChanged.AddListener(new UnityAction<float>(this.OnaltitudeChanged));
			this.mLength = base.AddNumberedIntSlider("Length", 5, 50);
			this.mLength.onValueChanged.AddListener(delegate(float v)
			{
				this.OnlengthChanged(Mathf.CeilToInt(v));
			});
			this.mWidth = base.AddNumberedIntSlider("Width", 5, 50);
			this.mWidth.onValueChanged.AddListener(delegate(float v)
			{
				this.OnwidthChanged(Mathf.CeilToInt(v));
			});
			this.mHieght = base.AddNumberedIntSlider("Hieght", 1, 10);
			this.mHieght.onValueChanged.AddListener(delegate(float v)
			{
				this.OnhieghtChanged(Mathf.CeilToInt(v));
			});
			this.mScale = base.AddNumberedSlider("Scale", 1f, 40000f);
			this.mScale.onValueChanged.AddListener(new UnityAction<float>(this.OnscaleChanged));
			this.mReceiveActiveShadows = base.AddToggle("Receive Active Shadows");
			this.mReceiveActiveShadows.onValueChanged.AddListener(new UnityAction<bool>(this.OnreceiveActiveShadowsChanged));
			this.mEnablePhysics = base.AddToggle("Enable Physics");
			this.mEnablePhysics.onValueChanged.AddListener(new UnityAction<bool>(this.OnenablePhysicsChanged));
			this.mVolumetricCloudCompression = base.AddToggle("Volumetric Cloud Compression");
			this.mVolumetricCloudCompression.onValueChanged.AddListener(new UnityAction<bool>(this.OnvolumetricCloudCompressionChanged));
			this.mDisableElasticity = base.AddToggle("Disable Elasticity");
			this.mDisableElasticity.onValueChanged.AddListener(new UnityAction<bool>(this.OndisableElasticityChanged));
			this.mLockAltitude = base.AddToggle("Lock Altitude");
			this.mLockAltitude.onValueChanged.AddListener(new UnityAction<bool>(this.OnlockAltitudeChanged));
			this.mGtsAirCompression = base.AddNumberedSlider("GTS Air Compression", 1f, 7f);
			this.mGtsAirCompression.onValueChanged.AddListener(new UnityAction<float>(this.OngtsAirCompressionChanged));
			this.mLodEnabled = base.AddToggle("LOD Enabled");
			this.mLodEnabled.onValueChanged.AddListener(new UnityAction<bool>(this.OnlodEnabledChanged));
			this.mLodRange = base.AddNumberedSlider("LOD Mid Range", 1500f, 150000f);
			this.mLodRange.onValueChanged.AddListener(new UnityAction<float>(this.OnlodMidRangeChanged));
			this.mCloudCover = base.AddNumberedIntSlider("Cloud Cover", 1, 10);
			this.mCloudCover.onValueChanged.AddListener(delegate(float v)
			{
				this.OncloudCoverChanged(Mathf.CeilToInt(v));
			});
			this.mSpawnRange = base.AddNumberedIntSlider("Spawn Range", 0, 5);
			this.mSpawnRange.onValueChanged.AddListener(delegate(float v)
			{
				this.OnspawnRangeChanged(Mathf.CeilToInt(v));
			});
			this.UpdateValues();
			this.initialized = true;
		}

		// Token: 0x060018EA RID: 6378 RVA: 0x0009D282 File Offset: 0x0009B482
		public void Spawn()
		{
			GameController.cloudController.Populate = true;
		}

		// Token: 0x060018EB RID: 6379 RVA: 0x0009D28F File Offset: 0x0009B48F
		public void Clear()
		{
			GameController.cloudController.WipeClouds = true;
		}

		// Token: 0x060018EC RID: 6380 RVA: 0x0009D29C File Offset: 0x0009B49C
		private void OnuseSimpleCloudsChanged(bool val)
		{
			GameController.cloudController.UseSimpleClouds = val;
		}

		// Token: 0x060018ED RID: 6381 RVA: 0x0009D2A9 File Offset: 0x0009B4A9
		private void OnovercastChanged(bool val)
		{
			GameController.cloudController.Overcast = val;
		}

		// Token: 0x060018EE RID: 6382 RVA: 0x0009D2B6 File Offset: 0x0009B4B6
		private void OnaltitudeChanged(float val)
		{
			GameController.cloudController.CloudAltitude = val;
		}

		// Token: 0x060018EF RID: 6383 RVA: 0x0009D2C3 File Offset: 0x0009B4C3
		private void OnlengthChanged(int val)
		{
			GameController.cloudController.CloudSpawnAreaRandomX = val;
		}

		// Token: 0x060018F0 RID: 6384 RVA: 0x0009D2D0 File Offset: 0x0009B4D0
		private void OnwidthChanged(int val)
		{
			GameController.cloudController.CloudSpawnAreaRandomZ = val;
		}

		// Token: 0x060018F1 RID: 6385 RVA: 0x0009D2DD File Offset: 0x0009B4DD
		private void OnhieghtChanged(int val)
		{
			GameController.cloudController.CloudSpawnAreaRandomHieght = val;
		}

		// Token: 0x060018F2 RID: 6386 RVA: 0x0009D2EA File Offset: 0x0009B4EA
		private void OnscaleChanged(float val)
		{
			GameController.cloudController.CloudScale = val;
		}

		// Token: 0x060018F3 RID: 6387 RVA: 0x0009D2F7 File Offset: 0x0009B4F7
		private void OnreceiveActiveShadowsChanged(bool val)
		{
			GameController.cloudController.ActiveShadows = val;
		}

		// Token: 0x060018F4 RID: 6388 RVA: 0x0009D304 File Offset: 0x0009B504
		private void OnenablePhysicsChanged(bool val)
		{
			GameController.cloudController.CloudPhysics = val;
		}

		// Token: 0x060018F5 RID: 6389 RVA: 0x0009D311 File Offset: 0x0009B511
		private void OnvolumetricCloudCompressionChanged(bool val)
		{
			GameController.cloudController.CloudCompression = val;
		}

		// Token: 0x060018F6 RID: 6390 RVA: 0x0009D31E File Offset: 0x0009B51E
		private void OndisableElasticityChanged(bool val)
		{
			GameController.cloudController.DisableCloudElastisity = val;
		}

		// Token: 0x060018F7 RID: 6391 RVA: 0x0009D32B File Offset: 0x0009B52B
		private void OnlockAltitudeChanged(bool val)
		{
			GameController.cloudController.LockCloudTileElevation = val;
		}

		// Token: 0x060018F8 RID: 6392 RVA: 0x0009D338 File Offset: 0x0009B538
		private void OngtsAirCompressionChanged(float val)
		{
			GameController.cloudController.GtsAirComressionFactor = val;
		}

		// Token: 0x060018F9 RID: 6393 RVA: 0x0009D345 File Offset: 0x0009B545
		private void OnlodEnabledChanged(bool val)
		{
			GameController.cloudController.CloudLODEnabled = val;
		}

		// Token: 0x060018FA RID: 6394 RVA: 0x0009D352 File Offset: 0x0009B552
		private void OnlodMidRangeChanged(float val)
		{
			GameController.cloudController.MidDistanceLOD = val;
		}

		// Token: 0x060018FB RID: 6395 RVA: 0x0009D35F File Offset: 0x0009B55F
		private void OncloudCoverChanged(int val)
		{
			GameController.cloudController.SkyFill = val;
		}

		// Token: 0x060018FC RID: 6396 RVA: 0x0009D36C File Offset: 0x0009B56C
		private void OnspawnRangeChanged(int val)
		{
			GameController.cloudController.CloudHubSpawnRange = val;
		}

		// Token: 0x060018FD RID: 6397 RVA: 0x0009D37C File Offset: 0x0009B57C
		protected override void UpdateValues()
		{
			this.mUseSimpleClouds.isOn = GameController.cloudController.UseSimpleClouds;
			this.mOvercast.isOn = GameController.cloudController.Overcast;
			this.mAltitude.value = GameController.cloudController.CloudAltitude;
			this.mLength.value = (float)GameController.cloudController.CloudSpawnAreaRandomX;
			this.mWidth.value = (float)GameController.cloudController.CloudSpawnAreaRandomZ;
			this.mHieght.value = (float)GameController.cloudController.CloudSpawnAreaRandomHieght;
			this.mScale.value = GameController.cloudController.CloudScale;
			this.mReceiveActiveShadows.isOn = GameController.cloudController.ActiveShadows;
			this.mEnablePhysics.isOn = GameController.cloudController.CloudPhysics;
			this.mVolumetricCloudCompression.isOn = GameController.cloudController.CloudCompression;
			this.mDisableElasticity.isOn = GameController.cloudController.DisableCloudElastisity;
			this.mLockAltitude.isOn = GameController.cloudController.LockCloudTileElevation;
			this.mGtsAirCompression.value = GameController.cloudController.GtsAirComressionFactor;
			this.mLodEnabled.isOn = GameController.cloudController.CloudLODEnabled;
			this.mLodRange.value = GameController.cloudController.MidDistanceLOD;
			this.mCloudCover.value = (float)GameController.cloudController.SkyFill;
			this.mSpawnRange.value = (float)GameController.cloudController.CloudHubSpawnRange;
		}

		// Token: 0x04001AF0 RID: 6896
		private Button mSpawnButton;

		// Token: 0x04001AF1 RID: 6897
		private Button mClearButton;

		// Token: 0x04001AF2 RID: 6898
		private Toggle mUseSimpleClouds;

		// Token: 0x04001AF3 RID: 6899
		private Toggle mOvercast;

		// Token: 0x04001AF4 RID: 6900
		private Slider mAltitude;

		// Token: 0x04001AF5 RID: 6901
		private Slider mLength;

		// Token: 0x04001AF6 RID: 6902
		private Slider mWidth;

		// Token: 0x04001AF7 RID: 6903
		private Slider mHieght;

		// Token: 0x04001AF8 RID: 6904
		private Slider mScale;

		// Token: 0x04001AF9 RID: 6905
		private Toggle mReceiveActiveShadows;

		// Token: 0x04001AFA RID: 6906
		private Toggle mEnablePhysics;

		// Token: 0x04001AFB RID: 6907
		private Toggle mVolumetricCloudCompression;

		// Token: 0x04001AFC RID: 6908
		private Toggle mDisableElasticity;

		// Token: 0x04001AFD RID: 6909
		private Toggle mLockAltitude;

		// Token: 0x04001AFE RID: 6910
		private Slider mGtsAirCompression;

		// Token: 0x04001AFF RID: 6911
		private Toggle mLodEnabled;

		// Token: 0x04001B00 RID: 6912
		private Slider mLodRange;

		// Token: 0x04001B01 RID: 6913
		private Slider mCloudCover;

		// Token: 0x04001B02 RID: 6914
		private Slider mSpawnRange;

		// Token: 0x04001B03 RID: 6915
		private Toggle mSpawnAdvancedClouds;

		// Token: 0x04001B04 RID: 6916
		private Toggle mDeleteAdvancedClouds;
	}
}
